const addTogether = (...nums) => {
  if (nums.length === 1 && typeof nums[0] === 'number') {
    return function (num) {
      if (typeof num !== 'number') return undefined;
      return num + nums[0];
    }
  } else if (nums.length == 2) {
    if (typeof nums[0] !== 'number' || typeof nums[1] !== 'number') return undefined;
    else return nums[0] + nums[1];
  }
  return undefined;
}


let output = addTogether(2, 3);
output = addTogether(5)([3]);
console.log(output);

